<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>home page</title>
		<script>
			function del() {
				return confirm('DEL?');
			}
		</script>
	</head>
	<body>
		<h1>Home Page</h1>
		${sessionScope.username }<br>
		<a href="user_logout">LOGOUT</a>
		<hr>
		<form action="book_add" method="post">
			title: <input name="book.title"><br>
			author: <input name="book.author"><br>
			publisher: <input name="book.publisher"><br>
			time: <input name="book.time"><br>
			<input type="submit" value="ADD">
		</form>
		<hr>
		<table border="1">
			<tr>
				<th>ID</th>
				<th>TITLE</th>
				<th>AUTHOR</th>
				<th>PUBLISHER</th>
				<th>TIME</th>
				<th colspan="2">OPERATION</th>
			</tr>
			<c:forEach var="book" items="${sessionScope.books }" varStatus="vs">
			<tr>
				<td>${vs.count }</td>
				<td>${book.title }</td>
				<td>${book.author }</td>
				<td>${book.publisher }</td>
				<td>${book.time }</td>
				<td><a href="book_search?book.id=${book.id }">EDIT</a></td>
				<td><a href="book_remove?book.id=${book.id }" onclick="return del()">DELETE</a></td>
			</tr>
			</c:forEach>
		</table>
	</body>
</html>